dojo.provide("lotex.report.Row");

dojo.require("dojo.lang.declare");
dojo.require("lotex.report.Cell");
dojo.require("lotex.report.AbstractReport");

lotex.report.Row = function(){
    this.cells = [];
    this.tagName = "TR";
    //this.hashcode = Math.random();
}

dojo.lang.extend(lotex.report.Row, {
    addCell: function(cell) {
        cell.parent = this;
        this.cells.push(cell);
    },

    copyProperty: function(row) {
        this.initClassFromDOM(row);
    },

    toStr: function() {
        var s = [];

        s.push('<');
        s.push(this.tagName);
        s.push(this.getClassStr());
        s.push('>');
        for (var i=0; i<this.cells.length; i++) {
            s.push(this.cells[i].toStr());
        }
        s.push('</'+this.tagName+'>');
        return s.join('');
    },

    clone: function() {
        var _clone = new lotex.report.Row();
        _clone._classnames = lotex.array.clone(this._classnames);
        _clone.parent = this.parent;

        var len = this.cells.length;
        for (var i=0;i<len;i++) {
            _clone.addCell(dojo.lang.shallowCopy(this.cells[i]));
        }
        return _clone;
    },

    readConfig: function() {
        var cfg = {};
        var _C = lotex.report.Constants;
        cfg.group = this.getConfigItem("group", _C.SCOPE_ALL, _C.SCOPE_ALL);

        var sheet = this.parent;
        lotex.lang.inhert(cfg, sheet.getConfig());
        return cfg;
    }
});

dojo.lang.extend(lotex.report.Row, lotex.report.AbstractReport);